import request from '@/utils/request'

// 获取所有库存
export function listChemicalStock(params) {
  return request({
    url: '/api/stock/list',
    method: 'get',
    params
  })
}

// 根据 chemicalId 获取单条库存信息
export function getChemicalStockByChemicalId(chemicalId) {
  return request({
    url: `/api/stock/${chemicalId}`,
    method: 'get'
  })
}

// 新增或更新库存
export function saveChemicalStock(data) {
  return request({
    url: '/api/stock/save',
    method: 'post',
    data
  })
}

// 删除库存记录
export function deleteChemicalStock(stockId) {
  return request({
    url: `/api/stock/${stockId}`,
    method: 'delete'
  })
}
